import { reactive } from "vue";
import { IPageCmpnt, IContainerCmpnt, IWidgetCmpnt } from "xcore/cmpnt/types";

export interface IPageMeta extends IPageCmpnt {
  meta: Record<string, any>;
}
interface Data {
  page: IPageMeta,
  conf: {
    saveSpan: number;
    autoSave: boolean;
    editable: boolean;
    selected: IPageCmpnt | IContainerCmpnt | IWidgetCmpnt | null; // 假设 selected 也是一个对象，其属性值和键都是任意的
  };
  history: {
    index: number;
    maxStep: number;
    steps: IPageCmpnt[]; // 假设 steps 是一个数组，其元素类型是任意的
  };
}

const store = reactive<Data>({
  page: {} as IPageMeta,
  conf: {
    editable: false,
    autoSave: true,
    saveSpan: 5000,
    selected: null,
  },
  history: {
    index: -1,
    maxStep: 20,
    steps: [],
  },
});

export { store };